import { ref } from "vue";
import { useIntersectionObserver } from "@vueuse/core";

const useLazyData = (asyncCallback:any) => {
   const target = ref(null);
   const { stop } = useIntersectionObserver(target, ([{ isIntersecting }]) => {
      if (isIntersecting) {
         stop();
         asyncCallback();
      }
   }, { threshold: 0 });
   return target;
};
